module dogre.scenemanager;

import std.string;
import dogre.camera;
import dogre.entity;
import dogre.resourcegroupmanager;
import dogre.scenenode;
import dogre.light;
import dogre.colourvalue;
import dogre.common;
import dogre.internals.utils;

extern(C)
{
    void* getSceneManagerWrapperFromPointer(void* ptr);
    void* call_createCamera(void* ptr, const(char)* name);
    void* call_createEntity(void* ptr, const(char)* entityName, const(char)* meshName, const(char*) groupName);
    void* call_getRootSceneNode(void* ptr);
    void call_setAmbientLight(void* ptr, void* colour);
    void* call_createLight(void* ptr, const(char)* name);
    void call_setShadowTechnique(void* ptr, ShadowTechnique technique);
}

enum
{
    ST_GENERIC = 1,
    ST_EXTERIOR_CLOSE = 2,
    ST_EXTERIOR_FAR = 4,
    ST_EXTERIOR_REAL_FAR = 8,
    ST_INTERIOR = 16
}
alias int SceneType;
alias SceneType SceneTypeMask;

class SceneManager
{
    mixin(Wrapper);
    ~this(){}

    Camera createCamera(string name)
    {
        return new Camera(call_createCamera(p, toStringz(name)));
    }

    Entity createEntity(string name, string meshName, string groupName=ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)
    {
        return new Entity(call_createEntity(p, toStringz(name), toStringz(meshName), toStringz(groupName)));
    }

    SceneNode getRootSceneNode()
    {
        return new SceneNode(call_getRootSceneNode(p));
    }
    
    void setAmbientLight(ColourValue colour)
    {
        call_setAmbientLight(p, colour.p);
    }
    
    Light createLight(string name)
    {
        return new Light(call_createLight(p, toStringz(name)));
    }
    
    void setShadowTechnique(ShadowTechnique technique)
    {
        call_setShadowTechnique(p, technique);
    }
}
